﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SimpleHttpServer
{
    public class HttpInfoFormat : ITFormat<HttpActionInfo>
    {
        public string Format(HttpActionInfo item, string key)
        {
            if (string.IsNullOrEmpty(key))
                return string.Empty;

            var findKey = key.ToLower();

            if (findKey == "controller")
            {
                return item.Controller?.GetType().Name;
            }
            else if (findKey == "action")
            {
                return item.Action?.Name;
            }

            return string.Empty;
        }
    }
}
